<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<meta name="author" content="Kodinger">
	<title>登陆</title>
	<link rel="stylesheet" type="text/css" href="/css/bootstrap.css">
	<link rel="stylesheet" type="text/css" href="/css/my-login.css">
	<script type="text/javascript" src="/js/vue.js"></script>
</head>
<body class="my-login-page">
	<section class="h-100">
		<div class="container h-100">
			<div class="row justify-content-md-center h-100">
				<div class="card-wrapper" style="margin: 0 auto">
					<div class="brand">
						<img src="/img/logo.jpg">
					</div>
					<div class="card fat">
						<div class="card-body">
							<div id="div">
								<h4 class="card-title">登陆</h4>
								<form method="POST">
									<div class="form-group">
										<label for="tel">手机号码</label>
										
										<input id="tel" v-model="tEmployee.tel" type="tel" class="form-control" name="tel" value="" required autofocus>
									</div>
	
									<div class="form-group">
										<label for="pwd">密码
										</label>
										<input id="pwd" v-model="tEmployee.password" type="pwd" class="form-control" name="pwd" required data-eye>
									</div>
	
									<!-- <div class="form-group">
										<label>
											<input type="checkbox" name="remember"> 记住我
										</label>
									</div> -->
	
									<div class="form-group no-margin">
										<input type="button" value="登陆" class="btn btn-primary btn-block" @click="login()">
									</div>
									
								</form>
							</div>
						</div>
					</div>
					
				</div>
			</div>
		</div>
	</section>
	<script type="text/javascript">
		new Vue({
			el:"#div",
			data:{
				tEmployee:{
					tel:'',
					password:''
				}
			},
			methods:{
				login:function(){
					var _this=this;
					//发送ajax请求执行登陆
					$.ajax({
						url:"/person/login",
						data:_this.tEmployee,
						dataType:"json",
						success:function(data){
							alert("登录成功，即将跳转");
							if(data.obj.role==1){
								location.href="merchant.html";
							}else{
								location.href="adminIndex.html";
							}
						},
						error:function(error){
							alert("用户名或密码错误");
						}
					});
				}
			}
		});
	</script>
	<script src="/js/jquery-2.1.4.js"></script>
	<script src="/js/bootstrap.js"></script>
	<script src="/js/my-login.js"></script>
</body>
</html>